﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using Framework.Interfaces;
using RSSNewsGrabberModule.Configuration;

namespace RSSNewsGrabberModule
{
    public class RssDataProvider:IDataProvider
    {
        public RssDataProvider()
        {
            UrlsConfigurationSectionName = "rssUrls";
        }

        public IDataHeader<IDataChild> GetData(string url, IBaseCriteria criteria)
        {
            var configInfo = new AppSettings(ConfigurationManager.AppSettings["defaultMappingKey"],
                                             ConfigurationManager.AppSettings["fieldConfig"],
                                             ConfigurationManager.AppSettings["additionalInformationRoot"]);
            var loader= new DataLoader();
            return loader.LoadData(url,criteria, configInfo);
        }

        public string UrlsConfigurationSectionName { get; private set; }
    }
}
